function saveCurrentFile()
{
	var fileContents = editor.getValue();
	alert('here');
	$.ajax({
	  type: "POST",
	  url: '../save_part_file',
	  data: { file: currentPart,
	  		  lesson: lesson,
	  		  fileContents: fileContents },
	  success: function(response)
	  {
	  	 var currSrc = $("#lessonPartsFrame").attr("src");
		$("#lessonPartsFrame").attr("src", currSrc);
		
	  }
	});
}


function getLessonPart(fileName)
{
	console.log(lessonParts);
	for(var lessonPart in lesson_parts)
	{
		if(lessonParts[lessonPart].name == fileName)
		{
			alert('found it');
			return files[file];
		}
	}
	return false;
}

function changePart(part_file)
{
	$("#lessonPartsFrame").attr("src", '../get_lesson_part/' + lesson + '/' + part_file);
	currentPart = part_file;
	$.ajax({
	  type: "POST",
	  url: '../get_part_file_code',
	  data: { file: currentPart,
	  		  lesson: lesson},
	  success: function(response)
	  {
		editor.setValue(response);	
	  }
	});
	getLessonPart(part_file);


}
function savePartInfo()
{
	var youtubeStart = $("#startTime").val();
	var youtubeEnd = $("#endTime").val();
	var link = $('#youtubeLink').val();
	var name = $('#partName').val();
	$.ajax({
	  type: "POST",
	  url: '../save_part_info',
	  data: { part_id: part_id,
	  		  youtubeLink: link,
	  		  name: name,
	  		  youtubeEnd: youtubeEnd,
	  		  youtubeStart: youtubeStart },
	  success: function(response)
	  {
		alert('success');
	  }
	});
}